﻿using GalaSoft.MvvmLight.Ioc;
using GalaSoft.MvvmLight.Messaging;
using System.Threading;
using System.Windows;
using System.Windows.Threading;
using WorldSimulator.PhysicEngine;
using WorldSimulator.PhysicsEngine;
using WorldSimulator.RenderingEngine;
using WorldSimulatorWPF.Messages;
using WorldSimulatorWPF.ViewModel;

namespace WorldSimulatorWPF
{
	/// <summary>
	/// Interaction logic for MainWindow.xaml
	/// </summary>
	public partial class MainWindow : Window
	{
		/// <summary>
		/// Initializes a new instance of the MainWindow class.
		/// </summary>
		public MainWindow()
		{
			InitializeComponent();
			Closing += (s, e) => ViewModelLocator.Cleanup();
		}

		private void Window_Loaded(object sender, RoutedEventArgs e)
		{
			SimpleIoc.Default.Register<IRenderingEngine>(() => this.RenderWindow);
			Messenger.Default.Send(new RenderingEngineConnectedMessage());
		}
	}
}